<!--物资服务绑定总览-->
<template>
    <u-collapse-item ref="supplyMaterial" :open="true">
        <text slot="title" class="u-page__title">物资服务绑定总览</text>
        <text class="u-collapse-content">
            <view class="common-body-ex">
                    <view style="padding:20rpx;background-color: #efefef">
                        <view class="common-list-ex" style="justify-content: space-between;align-items: center;height: 36rpx">
                            <label style="font-size: 32rpx;">物资绑定明细:</label>
                            <view style="font-size: 28rpx;color:#CA171D;text-decoration: underline;padding-top: 10rpx" @click="jump('01')">查看详情</view>
                        </view>
                    </view>
                    <view style="padding:20rpx;">
                        <view class="common-list-ex" style="justify-content: space-between;align-items: center;height: 36rpx">
                            <label style="font-size: 32rpx;">服务绑定明细:</label>
                            <view style="font-size: 28rpx;color:#CA171D;text-decoration: underline;padding-top: 10rpx" @click="jump('02')">查看详情</view>
                        </view>
                    </view>
            </view>
        </text>
    </u-collapse-item>
</template>

<script>
export default {
    components: {
    },
    props:{
        prjDetail: {
            type: Object,
            required: true,
            default: () => ({})
        },
        prjType: {
            type: String,
            required: true,
        }
    },
    data() {
        return {
            subPrjIds:[]
        }
    },
    mounted() {
        this.getSubPrjId()
    },
    methods:{
        getSubPrjId(){
            if(this.prjDetail.manageMode === '03'){
                const params={
                    prjId: this.prjDetail.prjId,
                    comprehensiveQuery:'1',
                    ifSingleProject: false,
                    pageNum: 1,
                    pageSize: 999
                }
                this.$axios.post('/acceptance/api/accept/commonAcceptance/getSiteList',params).then((res)=>{
                    this.subPrjIds = res.data.rows.map(item => item.prjId)
                })
            }else{
                this.subPrjIds=[this.prjDetail.prjId]
            }
        },
        jump(type){
            if(type === '01'){
                // uni.navigateTo({
                //     url:"/inspur/acceptance/components/materialTabs?subPrjIds=" + encodeURIComponent(JSON.stringify(this.subPrjIds)),
                // })
                imp.iWindow.open({url:`${process.uniEnv.BASE_ZR_URL}/#/inspur/acceptance/components/materialTabs?subPrjIds=${encodeURIComponent(JSON.stringify(this.subPrjIds))}`})
            }else{
                // uni.navigateTo({
                //     url:"/inspur/acceptance/components/serviceTabs?subPrjIds=" + encodeURIComponent(JSON.stringify(this.subPrjIds)),
                // })
                imp.iWindow.open({url:`${process.uniEnv.BASE_ZR_URL}/#/inspur/acceptance/components/serviceTabs?subPrjIds=${encodeURIComponent(JSON.stringify(this.subPrjIds))}`})
            }
        }
    }
}
</script>

<style>@import "@/common/common-ui.css";</style>
<style>@import "@/common/uView.css";</style>
<style scoped lang="scss">
.u-page{
    .u-collapse-body{
        height: auto !important;
    }
}
.gray{
    background-color:#efefef;
}
</style>